//创建“外壳”组件App
import React,{Component} from 'react'
import axios from 'axios'

//创建并暴露App组件
export default class App extends Component{
	getCarData = () => {
		axios.get('/api2/cars').then(
			response => {
				console.log('success',response.data);
			},
			error => {
				console.log('fail',error);
			}
		)
	}
	getStudentData = () => {
		axios.get('/api1/students').then(
			response => {
				console.log('success',response.data);
			},
			error => {
				console.log('fail',error);
			}
		)
	}
	render(){
		return (
			<div>
				<button onClick={this.getStudentData}>点我获取学生数据</button>
				<button onClick={this.getCarData}>点我获取汽车数据</button>
			</div>
		)
	}
}
